from tortoise import fields
from tortoise.models import Model


class Dept(Model):
    id = fields.IntField(pk=True, description="部门ID")
    parent_id = fields.IntField(description="父级编号", default=0)
    dept_name = fields.CharField(max_length=50, description="部门名称")
    sort = fields.IntField(description="排序", default=0)
    leader = fields.CharField(max_length=50, description="负责人")
    phone = fields.CharField(max_length=20, description="联系方式")
    email = fields.CharField(max_length=50, description="邮箱")
    status = fields.IntField(description="状态(1开启,0关闭)", default=1)
    remark = fields.TextField(description="备注", null=True)
    address = fields.CharField(max_length=255, description="详细地址", null=True)
    create_at = fields.DatetimeField(auto_now_add=True, description="创建时间")
    update_at = fields.DatetimeField(auto_now=True, description="更新时间")

    class Meta:
        table = "admin_dept"
